package com.cy.pj.goods.dao;

import com.cy.pj.goods.pojo.Goods;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.io.InputStream;
import java.util.List;
@Repository
public class GoodsDaoImpl implements GoodsDao{
    @Autowired
    private SqlSession sqlSession;//SqlSessionTemplate类型（线程安全）

    @Override
    public List<Goods> findGoods() {//在此方法内部使用Sqlsession实现与数据库会话
        System.out.println("==findGoods==");
        String statement = "com.cy.pj.goods.dao.GoodsDao.findGoods";//namespace + id

        return sqlSession.selectList(statement);
    }
}
